package ink.yuanchu.picachoframework.entity;

import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.annotation.Unique;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 用户实体
 * </p>
 *
 * @author ziyuan
 * @since 2021-02-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="User对象", description="")
@Table
public class User implements Serializable {

    /**
     * 序列化id
     */
    private static final long serialVersionUID = 1L;

    /**
     * id 主键
     */
    @IsKey
    @Column(comment = "主键id",length = 100)
    private String id;

    /**
     * 密码  不让它序列化 transient
     */
    @Column(comment = "密码")
    private String password;

    /**
     * 角色id
     */
    @Column(comment = "角色Id")
    private String roleId;

    /**
     * 用户名
     */
    @Unique
    @Column(comment = "用户名",length = 100)
    private String username;

    /**
     * 逻辑删除值
     */
    @TableLogic
    @Column(comment = "逻辑删除值")
    private int deleted;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Column(comment = "创建时间",type = MySqlTypeConstant.DATETIME)
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Column(comment = "更新时间",type = MySqlTypeConstant.DATETIME)
    private Date updateTime;

    /**
     * 乐观锁
     */
    @Version
    @TableField(fill = FieldFill.INSERT)
    @Column(comment = "乐观锁")
    private Integer version;

}
